package de.jkoslows.ui.components;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;

import de.jkoslows.ui.actions.CloseWindow;

public class MenuBar extends JPanel{

	private JFrame application;


	public MenuBar(JFrame application) {
		super();
		this.application = application;
		this.setLayout(new BorderLayout());
		this.setVisible(true);
		application.add(this, BorderLayout.NORTH);
	}
	
	
	public void create(){
		JMenuBar menuBar = new JMenuBar();
		JMenu systemMenu = createSystemMenu(this.application);
		menuBar.add(systemMenu);
		
		this.add(menuBar, BorderLayout.NORTH);
		menuBar.setVisible(true);
	}
	
	
	private JMenu createSystemMenu(JFrame applicationWindow) {
		JMenu systemMenu = new JMenu("System");
		CloseWindow closeWindowAction = new CloseWindow(applicationWindow);
		systemMenu.add(closeWindowAction);
		return systemMenu;
	}
	

}
